let Resource = function () {
}

Resource.prototype.get = function (url) {
    return new Promise((resolve, reject) => {
        let xhr = new XMLHttpRequest();
        xhr.open("GET", url, true);
        xhr.onload = function () {
            if (xhr.readyState === 4 && xhr.statusText) {
                resolve(xhr.responseText);
            }
        };
        xhr.onerror = function (e) {
            reject(e, xhr);
        };
        xhr.send(null);
    })
}

const resource = new Resource();
export default resource;